/*  PrimeBlaster
    by Kjetil Eide 
    kjetile445@gmail.com

    This file is part of PrimeBlaster

    PrimeBlaster is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    PrimeBlaster is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PrimeBlaster.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.eide.spaceship;

import org.newdawn.slick.AngelCodeFont;
import org.newdawn.slick.Animation;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;

public class ImageData {
	private Image[] asteroidImageType;
	private Image wallImage;
	private Image wallVertical;
	private Image wallHorizontal;
	private Image shipImage;
	
	private AngelCodeFont font;
	private AngelCodeFont numberFont;
	
	private Animation explosion;
	
	public ImageData() throws SlickException {
		asteroidImageType  = new Image[7];
		asteroidImageType[0] = new Image("spacedata/asteroid1.png");
		asteroidImageType[1] = new Image("spacedata/asteroid2.png");
		asteroidImageType[2] = new Image("spacedata/asteroid3.png");
		asteroidImageType[3] = new Image("spacedata/asteroid4.png");
		asteroidImageType[4] = new Image("spacedata/asteroid5.png");
		asteroidImageType[5] = new Image("spacedata/asteroid6.png");
		asteroidImageType[6] = new Image("spacedata/asteroid7.png");
	
		//shipImage = new Image("spacedata/romskipNoEngine.png");
		shipImage = new Image("spacedata/spaceship_scaled.png");
		wallImage = new Image("spacedata/wall.jpg");
		wallVertical = wallImage.getScaledCopy(10, PrimeBlaster.SCREEN_HEIGHT);
		wallHorizontal = wallImage.getScaledCopy(PrimeBlaster.SCREEN_WIDTH, 10);
	
		font = new AngelCodeFont("spacedata/hiero.fnt","spacedata/hiero.png");
		numberFont = new AngelCodeFont("spacedata/numbers.fnt","spacedata/numbers_00.png");

		SpriteSheet explosionSheet = new SpriteSheet("spacedata/SkybusterExplosionTransparent.png", 320, 240); 
		explosion = new Animation();
		int x = 0;
		int y = 0;
		for (int i = 0; i < 18; i++) {
			explosion.addFrame(explosionSheet.getSprite(x, y), 50);
			x++;
			if (x > 3) {
				x = 0;
				y++;
			}
		}
		explosion.setLooping(false);
	}
	
	public Image getAsteroidImage(int type) {
		return asteroidImageType[type];
	}
	
	public Image getWallImage() {
		return wallImage;
	}
	
	public Image getWallVertical() {
		return wallVertical;
	}

	public Image getWallHorizontal() {
		return wallHorizontal;
	}

	public Image getShipImage() {
		return shipImage;
	}	

	public Animation getExplosionAnim() {
		explosion.setCurrentFrame(0);
		return explosion;
	}
	
	public AngelCodeFont getFont() {
		return font;
	}
	
	public AngelCodeFont getNumberFont() {
		return numberFont;
	}
}
